package com.lovo.test.GuessingGame;

import java.util.Scanner;

//玩家角色
public class Player extends Role{
    public int guessingGame(){
        Computer computer = new Computer();
        int countWin =0;//赢了计数
        for (int i = 0; i < 10; i++) {
            Scanner scan = new Scanner(System.in);
            System.out.println("请输入0-石头，1-剪刀，2-布");
            int number= scan.nextInt();
            int index  =computer.guessingGame();
            System.out.println("电脑出"+index);
            if (number==0){
                if (index==0){
                    System.out.println("平局，不计分");
                }else if (index==1){
                    countWin++;
                    System.out.println("你赢了，加一分");
                }else if (index==2){
                    System.out.println("你输了");
                }
            }else if (number==1){
                if (index==0){
                    System.out.println("你输了");
                }else if (index==1){
                    System.out.println("平局，不计分");
                }else if (index==2){
                    countWin++;
                    System.out.println("你赢了，加一分");
                }

            }else if (number==2){
                if (index==0){
                    countWin++;
                    System.out.println("你赢了，加一分");
                }else if (index==1){
                    System.out.println("你输了");
                }else if (index==2){
                    System.out.println("平局，不计分");
                }
            }

        }
        return countWin;
    }
}
